/* 优化后的游戏房间样式 */

.container {
    display: flex;
    padding: 20px;
    gap: 20px;
    height: calc(100% - 60px);
}

#chess_area {
    flex: 2; /* 棋盘区域占更大比例 */
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

#screen {
    width: 100%;
    max-width: 450px;
    height: 60px;
    margin-top: 20px;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    font-size: 22px;
    font-weight: 600;
    line-height: 60px;
    text-align: center;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(37, 117, 252, 0.3);
     /* 添加动画效果 */
    transition: all 0.3s ease;
    /* 添加内阴影效果  */
    position: relative; 
}

/* 为提示区域添加闪烁动画效果 */
#screen.blink {
    animation: blink 1s ease-in-out;
}

@keyframes blink {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); box-shadow: 0 6px 20px rgba(37, 117, 252, 0.5); }
    100% { transform: scale(1); }
}

/* 游戏结束时的特殊样式 */
#screen.game-over {
    background: linear-gradient(135deg, #ff416c, #ff4b2b);
    box-shadow: 0 4px 15px rgba(255, 75, 43, 0.3);
}

#chess {
    margin-top: 20px;
    border: 2px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

#left_area {
    flex: 1; /* 左侧区域占较小比例 */
    display: flex;
    flex-direction: column;
    gap: 20px; /* 增加区域间的间距 */
}

.opponent-header {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    padding: 10px 15px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    text-align: center;
}

#oppoent_info {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    font-size: 16px;
    line-height: 1.8;
}

#oppoent_info span {
    font-weight: 600;
    color: #2c3e50;
}

#chat_area {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    height: 400px; /* 固定高度 */
    flex-shrink: 0; /* 防止在容器缩小时改变大小 */
}

#chat_show {
    flex: 1;
    overflow-y: auto; /* 启用垂直滚动 */
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #eee;
    /* 确保滚动区域不会因为内容增加而改变大小 */
    min-height: 0; /* 允许flex项目收缩 */
}

/* 自定义滚动条样式 */
#chat_show::-webkit-scrollbar {
    width: 8px;
}

#chat_show::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#chat_show::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

#chat_show::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

#msg_show {
    display: flex;
    gap: 10px;
    flex-shrink: 0; /* 防止在容器缩小时改变大小 */
}

#chat_input {
    flex: 1;
    height: 50px;
    padding: 0 15px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: all 0.3s ease;
    /* 固定输入框大小 */
    resize: none; /* 禁止用户调整大小 */
    box-sizing: border-box; /* 确保padding和border包含在元素的总宽高内 */
    min-height: 50px; /* 确保最小高度 */
    max-height: 50px; /* 确保最大高度 */
}

#chat_input:focus {
    border-color: #4a90e2;
    outline: none;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

#chat_button {
    width: 100px;
    height: 50px;
    background: linear-gradient(135deg, #4a90e2, #2c3e50);
    color: white;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(74, 144, 226, 0.3);
    flex-shrink: 0; /* 防止按钮在容器缩小时变形 */
}

#chat_button:hover {
    background: linear-gradient(135deg, #3a7bc8, #1a2a3a);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(74, 144, 226, 0.4);
}

#chat_button:active {
    background: linear-gradient(135deg, #2c3e50, #4a90e2);
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(74, 144, 226, 0.3);
}

.self_msg {
    max-width: 70%;
    padding: 10px 15px;
    margin: 5px 0;
    background: linear-gradient(135deg, #4a90e2, #5ba0f2);
    color: white;
    border-radius: 18px 18px 5px 18px;
    float: right;
    clear: both;
    font-size: 14px;
    line-height: 1.4;
}

.peer_msg {
    max-width: 70%;
    padding: 10px 15px;
    margin: 5px 0;
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
    border-radius: 18px 18px 18px 5px;
    float: left;
    clear: both;
    font-size: 14px;
    line-height: 1.4;
}

/* 游戏结束按钮 */
#exit-button {
    margin-top: 20px;
    width: 200px;
    height: 50px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(231, 76, 60, 0.3);
}

#exit-button:hover {
    background: linear-gradient(135deg, #c0392b, #a5281b);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(231, 76, 60, 0.4);
}

#exit-button:active {
    background: linear-gradient(135deg, #a5281b, #e74c3c);
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(231, 76, 60, 0.3);
}